package com.example.device.adapter


import android.annotation.SuppressLint
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.device.R
import com.example.device.entity.DeviceEntityItem
import com.example.device.entity.DeviceOrderEntityItem

class DeviceOrderAdapter:BaseQuickAdapter<DeviceOrderEntityItem,BaseViewHolder>(R.layout.item_device) {
    @SuppressLint("SuspiciousIndentation")
    override fun convert(holder: BaseViewHolder, item: DeviceOrderEntityItem) {
        holder.getView<TextView>(R.id.device_deviceType).text="设备类别: ${item.orderType}"
        val status=holder.getView<TextView>(R.id.device_status)
        holder.getView<TextView>(R.id.device_failureRate).text="内容: ${item.content}"
        holder.getView<TextView>(R.id.device_installationLocation).text="安装地点: ${item.address}"
        status.text=item.status
            if (item.status=="新建"){
                status.setBackgroundResource(R.drawable.bg_blue)
            }else if (item.status=="进行中"){
                status.setBackgroundResource(R.drawable.bg_ju)
            }else if (item.status=="已完成"){
                status.setBackgroundResource(R.drawable.bg_red)
            }else if (item.status=="已转派"){
                status.setBackgroundResource(R.drawable.bg_zi)
            }

    }
}